console.log("********************");
console.log("运算符")
console.log("\n");
/**运算符
 * （1） 算术运算符
 *       + - * / % ++ --
 *       赋值运算符 += -= *= /= %=
 * (2) 比较运算符
 *     > < >= <= == != === !==
 * (3) 逻辑运算符
 *     && || !
 * (4) 位运算符
      ~ & | ^ << >> >>>
 */

var a = 66;
var b = 88;

function dig() {
    console.log("a=" + a + " b=" + b)
    console.log("a+b=" + (a + b))
    console.log("a-b=" + (a - b))
    console.log("a*b=" + (a * b))
    console.log("a/b=" + (a / b))
    console.log("a++", a++)
    console.log("++a", ++a)
    console.log("b--", b--)
    console.log("--b", --b)
    console.log("\n********************");
}
// dig()
function compare() {
    console.log("a>b\t", a > b);
    console.log("a<b\t", a < b);
    console.log("a>=b\t", a >= b);
    console.log("a<=b\t", a <= b);
    console.log("\n********************");
    var c = "66";
    console.log('a=66 c="66" a==c ', a == c);// nodejs比较严格      ===
    console.log("a=66 c='66' a!=c ", a != c);// nodejs比较严格    !==

    console.log('a=66 c="66" a===c ', a === c);
    console.log("a=66 c='66' a!==c ", a !== c);

}
// compare()
function legal() {
    console.log("a=66,b=88");
    console.log("a>b && a<b,a>b && a<b");
    console.log("a>b || a<b", a > b || a < b);
    console.log("!(a>b)", !(a > b));
}
// legal()

function controller1() {
    if (a < b) {
        console.log("a<b时执行这里的代码")
    }
}
// controller1()
function controller2() {
    if (a > b) {
        console.log("a<b时执行这里的代码")
    } else {
        console.log("a比b小,所以执行这里else语句")
    }
}
// controller2()

function controller3(score = 0) {
    if (typeof (score) != "number") {
        console.log("输入的成绩必须是个数字");
    } else if (score > 100 || score < 0) {
        console.log("输入的成绩非法,不能超过一百或者小于0");
    } else if (score <= 100 && score >= 60) {
        console.log("及格了");
    } else {
        console.log("不及格");
    }
}
// constoller3(60)

function constroller4(currentDay) {
    var date = new Date("2023-2-" + currentDay)
    var week = date.getDate();
    switch (week) {
        case 0:
            console.log("星期日");
            break;
        case 1:
            console.log("星期一");
            break;
        case 2:
            console.log("星期二");
            break;
        case 3:
            console.log("星期三");
            break;
        case 4:
            console.log("星期四");
            break;
        case 5:
            console.log("星期五");
            break;
        case 6:
            console.log("星期六");
            break;
    }
}

// constroller4(15)
function getDay(currentDay) {
    if (typeof (currentDay) != "number") {
        console.log("输入的成绩必须是个数字");
    } else {
        var date = new Date("2023-2-" + currentDay);
        var weeks = ["日", "一", "二", "四", "五", "六",];
        console.log("2023-2-" + currentDay + "是星期" + weeks[date.getDate()]);
    }
}
getDay(14)